Skip to content

Conversation

@Tobbe
Copy link
Member

@Tobbe Tobbe commented Oct 30, 2025

Cedar has never supported yarn v1. And neither has RW for a long time. So this PR is just cleaning up old legacy code

@Tobbe Tobbe added this to the next-release-patch milestone Oct 30, 2025
@netlify
Copy link

netlify bot commented Oct 30, 2025

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit ade12d2
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/69035877ff464c0008c95e8c

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR removes all Yarn v1 compatibility code from the Cedar CLI, simplifying yarn command invocations across multiple handlers.

Key Changes:

  • Removed getCmdMajorVersion() function from packages/cli/src/commands/upgrade.js:508-525 that detected yarn version
  • Eliminated yarn v1-specific flags: -W (workspace flag), -s (silent flag), --force, and --non-interactive
  • Simplified yarn install, yarn dedupe, yarn add, and yarn tsc commands to use only yarn v2+ syntax
  • Removed unused mock in type-check.test.js:46-48 for getCmdMajorVersion

Issue Found:

  • Test expectations in type-check.test.js:80,85,105 still expect double-space formatting ('yarn tsc') from the old conditional logic, but the actual command now produces single-space formatting ('yarn tsc'). Tests will fail without updating the expected strings.

Confidence Score: 3/5

  • This PR has critical test failures that must be fixed before merging
  • The refactoring itself is clean and correct—all yarn v1 code is properly removed. However, the test file has outdated expectations that will cause CI failures. The score reflects that the code changes are sound but tests need updates.
  • packages/cli/src/commands/tests/type-check.test.js requires test expectation updates to match the new command format

Important Files Changed

File Analysis

Filename Score Overview
packages/cli/src/commands/tests/type-check.test.js 2/5 Removed mock for getCmdMajorVersion, but test expectations still expect double space in yarn command (will fail)
packages/cli/src/commands/setup/ui/libraries/tailwindcssHandler.js 5/5 Removed yarn version detection and -W flag logic, now always uses standard yarn add -D
packages/cli/src/commands/type-checkHandler.js 5/5 Removed yarn version check and -s flag logic, simplified to yarn tsc --noEmit --skipLibCheck
packages/cli/src/commands/upgrade.js 5/5 Removed getCmdMajorVersion function and yarn v1-specific flags (--force, --non-interactive) from install and dedupe
packages/cli/src/lib/index.js 5/5 Removed yarn version detection and -W flag from addPackagesTask function

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant YarnV2Plus as Yarn v2+

    Note over CLI: Before: Checked yarn version<br/>and used v1-specific flags

    User->>CLI: upgrade command
    CLI->>YarnV2Plus: yarn install (no --force, --non-interactive)
    CLI->>YarnV2Plus: yarn dedupe (no fallback logic)

    User->>CLI: type-check command
    CLI->>YarnV2Plus: yarn tsc (no -s flag)

    User->>CLI: setup ui tailwindcss
    CLI->>YarnV2Plus: yarn add -D (no -W flag)

    User->>CLI: addPackagesTask
    CLI->>YarnV2Plus: yarn add (no -W flag)

    Note over CLI,YarnV2Plus: After: All commands assume<br/>Yarn v2+ (no version checks)
Loading

Additional Comments (3)

  1. packages/cli/src/commands/__tests__/type-check.test.js, line 80 (link)

    syntax: test expects double space 'yarn tsc' but actual command now has single space 'yarn tsc'

  2. packages/cli/src/commands/__tests__/type-check.test.js, line 85 (link)

    syntax: test expects double space but actual command has single space

  3. packages/cli/src/commands/__tests__/type-check.test.js, line 105 (link)

    syntax: test expects double space but actual command has single space

5 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@Tobbe Tobbe merged commit 81259ac into main Oct 30, 2025
38 checks passed
@Tobbe Tobbe deleted the tobbe-remove-yarn-version-1-check branch October 30, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants